package com.spsy.order.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.spsy.common.core.annotation.Excel;
import com.spsy.common.core.web.domain.BaseEntity;

/**
 * 订单主表对象 order_info
 * 
 * @author arhat
 * @date 2025-11-04
 */
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrderInfo extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键ID，自增 */
    private Long id;

    /** 订单编号，全局唯一，业务标识号 */
    @Excel(name = "订单编号，全局唯一，业务标识号")
    private String orderSn;

    /** 用户ID */
    @Excel(name = "用户ID")
    private Long userId;

    /** 用户名（冗余字段） */
    @Excel(name = "用户名", readConverterExp = "冗=余字段")
    private String userName;

    /** 订单状态：0-待支付，1-已支付，2-已发货，3-已完成，4-已关闭，5-无效订单 */
    @Excel(name = "订单状态：0-待支付，1-已支付，2-已发货，3-已完成，4-已关闭，5-无效订单")
    private Long orderStatus;

    /** 订单类型：1-普通订单，2-秒杀订单，3-团购订单，4-预售订单 */
    @Excel(name = "订单类型：1-普通订单，2-秒杀订单，3-团购订单，4-预售订单")
    private Long orderType;

    /** 订单来源：1-APP，2-PC，3-小程序，4-H5 */
    @Excel(name = "订单来源：1-APP，2-PC，3-小程序，4-H5")
    private Long orderSource;

    /** 订单原价（商品总价） */
    @Excel(name = "订单原价", readConverterExp = "商=品总价")
    private BigDecimal originalAmount;

    /** 运费金额 */
    @Excel(name = "运费金额")
    private BigDecimal freightAmount;

    /** 优惠总金额（促销+优惠券） */
    @Excel(name = "优惠总金额", readConverterExp = "促=销+优惠券")
    private BigDecimal discountAmount;

    /** 促销优惠金额 */
    @Excel(name = "促销优惠金额")
    private BigDecimal promotionAmount;

    /** 优惠券抵扣金额 */
    @Excel(name = "优惠券抵扣金额")
    private BigDecimal couponAmount;

    /** 积分抵扣金额 */
    @Excel(name = "积分抵扣金额")
    private BigDecimal pointsAmount;

    /** 获取积分 */
    @Excel(name = "获取积分")
    private Long points;

    /** 实际支付金额 = original_amount + freight_amount - discount_amount */
    @Excel(name = "实际支付金额 = original_amount + freight_amount - discount_amount")
    private BigDecimal payAmount;

    /** 支付方式：1-支付宝，2-微信，3-银联，4-余额 */
    @Excel(name = "支付方式：1-支付宝，2-微信，3-银联，4-余额")
    private Long payType;

    /** 支付时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date payTime;

    /** 第三方支付交易号 */
    @Excel(name = "第三方支付交易号")
    private String transactionId;

    /** 订单过期时间（用于未支付自动取消） */
    @Excel(name = "订单过期时间", readConverterExp = "用=于未支付自动取消")
    private Date expireTime;

    /** 发货时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "发货时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date deliveryTime;

    /** 确认收货时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "确认收货时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date receiveTime;

    /** 评价时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "评价时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date commentTime;

    /** 订单关闭时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "订单关闭时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date closeTime;

    /** 物流公司 */
    @Excel(name = "物流公司")
    private String deliveryCompany;

    /** 物流单号 */
    @Excel(name = "物流单号")
    private String deliverySn;

    /** 用户备注/留言 */
    @Excel(name = "用户备注/留言")
    private String userRemark;

    /** 管理员备注 */
    @Excel(name = "管理员备注")
    private String adminRemark;

    /** 是否需要发票：0-否，1-是 */
    @Excel(name = "是否需要发票：0-否，1-是")
    private Integer invoiceFlag;

    /** 发票类型：1-个人，2-企业 */
    @Excel(name = "发票类型：1-个人，2-企业")
    private Long invoiceType;

    /** 发票抬头 */
    @Excel(name = "发票抬头")
    private String invoiceTitle;

    /** 发票内容 */
    @Excel(name = "发票内容")
    private String invoiceContent;

    /** 删除状态：0-未删除，1-已删除 */
    @Excel(name = "删除状态：0-未删除，1-已删除")
    private Integer deleteStatus;

    /** 版本号（用于乐观锁） */
    @Excel(name = "版本号", readConverterExp = "用=于乐观锁")
    private Long version;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }

    public void setOrderSn(String orderSn) 
    {
        this.orderSn = orderSn;
    }

    public String getOrderSn() 
    {
        return orderSn;
    }

    public void setUserId(Long userId) 
    {
        this.userId = userId;
    }

    public Long getUserId() 
    {
        return userId;
    }

    public void setUserName(String userName) 
    {
        this.userName = userName;
    }

    public String getUserName() 
    {
        return userName;
    }

    public void setOrderStatus(Long orderStatus) 
    {
        this.orderStatus = orderStatus;
    }

    public Long getOrderStatus() 
    {
        return orderStatus;
    }

    public void setOrderType(Long orderType) 
    {
        this.orderType = orderType;
    }

    public Long getOrderType() 
    {
        return orderType;
    }

    public void setOrderSource(Long orderSource) 
    {
        this.orderSource = orderSource;
    }

    public Long getOrderSource() 
    {
        return orderSource;
    }

    public void setOriginalAmount(BigDecimal originalAmount) 
    {
        this.originalAmount = originalAmount;
    }

    public BigDecimal getOriginalAmount() 
    {
        return originalAmount;
    }

    public void setFreightAmount(BigDecimal freightAmount) 
    {
        this.freightAmount = freightAmount;
    }

    public BigDecimal getFreightAmount() 
    {
        return freightAmount;
    }

    public void setDiscountAmount(BigDecimal discountAmount) 
    {
        this.discountAmount = discountAmount;
    }

    public BigDecimal getDiscountAmount() 
    {
        return discountAmount;
    }

    public void setPromotionAmount(BigDecimal promotionAmount) 
    {
        this.promotionAmount = promotionAmount;
    }

    public BigDecimal getPromotionAmount() 
    {
        return promotionAmount;
    }

    public void setCouponAmount(BigDecimal couponAmount) 
    {
        this.couponAmount = couponAmount;
    }

    public BigDecimal getCouponAmount() 
    {
        return couponAmount;
    }

    public void setPointsAmount(BigDecimal pointsAmount) 
    {
        this.pointsAmount = pointsAmount;
    }

    public BigDecimal getPointsAmount() 
    {
        return pointsAmount;
    }

    public void setPoints(Long points) 
    {
        this.points = points;
    }

    public Long getPoints() 
    {
        return points;
    }

    public void setPayAmount(BigDecimal payAmount) 
    {
        this.payAmount = payAmount;
    }

    public BigDecimal getPayAmount() 
    {
        return payAmount;
    }

    public void setPayType(Long payType) 
    {
        this.payType = payType;
    }

    public Long getPayType() 
    {
        return payType;
    }

    public void setPayTime(Date payTime) 
    {
        this.payTime = payTime;
    }

    public Date getPayTime() 
    {
        return payTime;
    }

    public void setTransactionId(String transactionId) 
    {
        this.transactionId = transactionId;
    }

    public String getTransactionId() 
    {
        return transactionId;
    }

    public void setExpireTime(Date expireTime) 
    {
        this.expireTime = expireTime;
    }

    public Date getExpireTime() 
    {
        return expireTime;
    }

    public void setDeliveryTime(Date deliveryTime) 
    {
        this.deliveryTime = deliveryTime;
    }

    public Date getDeliveryTime() 
    {
        return deliveryTime;
    }

    public void setReceiveTime(Date receiveTime) 
    {
        this.receiveTime = receiveTime;
    }

    public Date getReceiveTime() 
    {
        return receiveTime;
    }

    public void setCommentTime(Date commentTime) 
    {
        this.commentTime = commentTime;
    }

    public Date getCommentTime() 
    {
        return commentTime;
    }

    public void setCloseTime(Date closeTime) 
    {
        this.closeTime = closeTime;
    }

    public Date getCloseTime() 
    {
        return closeTime;
    }

    public void setDeliveryCompany(String deliveryCompany) 
    {
        this.deliveryCompany = deliveryCompany;
    }

    public String getDeliveryCompany() 
    {
        return deliveryCompany;
    }

    public void setDeliverySn(String deliverySn) 
    {
        this.deliverySn = deliverySn;
    }

    public String getDeliverySn() 
    {
        return deliverySn;
    }

    public void setUserRemark(String userRemark) 
    {
        this.userRemark = userRemark;
    }

    public String getUserRemark() 
    {
        return userRemark;
    }

    public void setAdminRemark(String adminRemark) 
    {
        this.adminRemark = adminRemark;
    }

    public String getAdminRemark() 
    {
        return adminRemark;
    }

    public void setInvoiceFlag(Integer invoiceFlag) 
    {
        this.invoiceFlag = invoiceFlag;
    }

    public Integer getInvoiceFlag() 
    {
        return invoiceFlag;
    }

    public void setInvoiceType(Long invoiceType) 
    {
        this.invoiceType = invoiceType;
    }

    public Long getInvoiceType() 
    {
        return invoiceType;
    }

    public void setInvoiceTitle(String invoiceTitle) 
    {
        this.invoiceTitle = invoiceTitle;
    }

    public String getInvoiceTitle() 
    {
        return invoiceTitle;
    }

    public void setInvoiceContent(String invoiceContent) 
    {
        this.invoiceContent = invoiceContent;
    }

    public String getInvoiceContent() 
    {
        return invoiceContent;
    }

    public void setDeleteStatus(Integer deleteStatus) 
    {
        this.deleteStatus = deleteStatus;
    }

    public Integer getDeleteStatus() 
    {
        return deleteStatus;
    }

    public void setVersion(Long version) 
    {
        this.version = version;
    }

    public Long getVersion() 
    {
        return version;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("orderSn", getOrderSn())
            .append("userId", getUserId())
            .append("userName", getUserName())
            .append("orderStatus", getOrderStatus())
            .append("orderType", getOrderType())
            .append("orderSource", getOrderSource())
            .append("originalAmount", getOriginalAmount())
            .append("freightAmount", getFreightAmount())
            .append("discountAmount", getDiscountAmount())
            .append("promotionAmount", getPromotionAmount())
            .append("couponAmount", getCouponAmount())
            .append("pointsAmount", getPointsAmount())
            .append("points", getPoints())
            .append("payAmount", getPayAmount())
            .append("payType", getPayType())
            .append("payTime", getPayTime())
            .append("transactionId", getTransactionId())
            .append("expireTime", getExpireTime())
            .append("deliveryTime", getDeliveryTime())
            .append("receiveTime", getReceiveTime())
            .append("commentTime", getCommentTime())
            .append("closeTime", getCloseTime())
            .append("deliveryCompany", getDeliveryCompany())
            .append("deliverySn", getDeliverySn())
            .append("userRemark", getUserRemark())
            .append("adminRemark", getAdminRemark())
            .append("invoiceFlag", getInvoiceFlag())
            .append("invoiceType", getInvoiceType())
            .append("invoiceTitle", getInvoiceTitle())
            .append("invoiceContent", getInvoiceContent())
            .append("deleteStatus", getDeleteStatus())
            .append("version", getVersion())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .append("createBy", getCreateBy())
            .append("updateBy", getUpdateBy())
            .toString();
    }
}
